import request from '@/utils/request'

// 查询角色列表
export function listRole(query) {
  return request({
    url: '/allocation/role/list',
    method: 'get',
    params: query
  })
}

// 查询角色详细
export function getRole(id) {
  return request({
    url: '/allocation/role/' + id,
    method: 'get'
  })
}

// 新增角色
export function addRole(data) {
  return request({
    url: '/allocation/role',
    method: 'post',
    data: data
  })
}

// 修改角色
export function updateRole(data) {
  return request({
    url: '/allocation/role',
    method: 'put',
    data: data
  })
}

// 删除角色
export function delRole(id) {
  return request({
    url: '/allocation/role/' + id,
    method: 'delete'
  })
}

// 消息状态修改
export function changeNoticeStatus(id, status) {
  const data = {
    id,
    status
  }
  return request({
    url: '/allocation/role/changeStatus',
    method: 'put',
    data: data
  })
}
// 入会状态修改
export function changeIsDefaultStatus(id, isDefault) {
  const data = {
    id,
    isDefault
  }
  return request({
    url: '/allocation/role/changeIsDefaultStatus',
    method: 'put',
    data: data
  })
}
// 报表权限状态修改
export function changeStatementStatus(id, statement) {
  const data = {
    id,
    statement
  }
  return request({
    url: '/allocation/role/changeStatementStatus',
    method: 'put',
    data: data
  })
}
// 通讯录状态修改
export function changeContactsStatus(id, contacts) {
  const data = {
    id,
    contacts
  }
  return request({
    url: '/allocation/role/changeContactsStatus',
    method: 'put',
    data: data
  })
}
// 查看权限状态修改
export function changeTypeStatus(id, type) {
  const data = {
    id,
    type
  }
  return request({
    url: '/allocation/role/changeTypeStatus',
    method: 'put',
    data: data
  })
}
// 查询用户--角色详细
export function getUserRole(id) {
  return request({
    url: '/allocation/userRole/' + id,
    method: 'get'
  })
}